home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10192 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!tsys.demon.co.uk
  2. From: Tom Wheeley <tomw@tsys.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: A question on for loop
  5. Date: Thu, 14 Mar 96 16:00:14 GMT
  6. Organization: City Zen FM
  7. Message-ID: <826819214snz@tsys.demon.co.uk>
  8. References: <31471574.79D9@hdc-usa.com> <4i77ca$161@ccshst05.cs.uoguelph.ca>
  9. Reply-To: tomw@tsys.demon.co.uk
  10. X-NNTP-Posting-Host: tsys.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.30
  12. X-Sig-By: Tomsystems Quote v1.2.  (c)1996 Tom Wheeley, tomw@tsys.demon.co.uk
  13. X-Mail2News-Path: tsys.demon.co.uk
  14.  
  15. In article <4i77ca$161@ccshst05.cs.uoguelph.ca>
  16.            thay@uoguelph.ca "Toby K Hay" writes:
  17.  
  18. > My novice's answer is yes, i starts off at 0 because the for statement 
  19. > (i=0;i<20;i++) has i++ meaning that i is incremented after the 
  20. > operation.  If it were (i=0;i<20;++i) then i would start at 1 and run up 
  21. > to 20.  Is this correct?
  22.  
  23. No.  On their own, i++ and ++i are identical, the only difference being the
  24. return value.  As that expression in the for loop discards the return value,
  25. it has no effect on the loop.  The `before and after' effects you refer to
  26. are only effective with the expression, not the entire loop.
  27.  
  28. .splitbung, likewise providing a novice's answer...
  29. --
  30. * TQ 1.0 * The 'Just So Quotes'.
  31. Trouble: Charles Manson.  *REAL* Trouble: His evil twin.
  32.     -- Mister Boffo
  33.